<template>
    <router-view>
    </router-view>
</template>


<script lang="ts">
import { defineComponent, ref } from 'vue';
import { useRouter } from 'vue-router';
export default defineComponent({
  name: 'App',
  setup() {
    const router = useRouter();
    const isLoggedIn = ref<boolean>(localStorage.getItem('isLoggedIn') === 'true');

    const logout = () => {
      sessionStorage.removeItem('isLoggedIn');  // 清除登录状态
      isLoggedIn.value = false;               // 更新本地登录状态
      router.push({ name: 'Login' });         // 重定向到登录页面
    };

    return {
      isLoggedIn,
      logout,
    };
  },
});
</script>





